CSharpTest.Net
AddRange Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Collections Namespace > BTreeList<T> Class : AddRange Method

items
The items to add to the ICollection.

Glossary Item Box

Adds a set of items to the ICollection.

Syntax

Visual Basic (Declaration) 
Public Sub AddRange( _
   ByVal items As IEnumerable(Of T) _
) 
C# 
public void AddRange( 
   IEnumerable<T> items
)

Parameters

items
The items to add to the ICollection.

Exceptions

ExceptionDescription
System.ArgumentExceptionAn element with the same value already exists in the IList.
System.NotSupportedExceptionThe IList is read-only.

Example

Library/Library.Test/TestBTreeList.cs

C#Copy Code
BTreeList<int> data = new BTreeList<int>(Comparer, GetSample());
BTreeList<int> copy = new BTreeList<int>();
copy.AddRange(data);
Assert.AreEqual(copy.Count, data.Count);
IList<int> lista = data, listb = copy;
for (int ix = 0; ix < data.Count; ix++)
    Assert.AreEqual(lista[ix], listb[ix]);
VB.NETCopy Code
Dim data As New BTreeList(Of Integer)(Comparer, GetSample())
Dim copy As New BTreeList(Of Integer)()
copy.AddRange(data)
Assert.AreEqual(copy.Count, data.Count)
Dim lista As IList(Of Integer) = data, listb As IList(Of Integer) = copy
Dim ix As Integer = 0
While ix < data.Count
    Assert.AreEqual(lista(ix), listb(ix))
    System.Math.Max(System.Threading.Interlocked.Increment(ix),ix - 1)
End While

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys